AllowableStrings

Defines a set of allowable strings for use in validation. Also supplies Suggestions to generate suggestion popups in-game.

NOTE: Expectation is that the predicate and supplier are based on matching sets of information; someone in theory could use the suppliers information to predicate an input, and the predicate could be used on a theoretical "parent" dataset of string to derive the same contents as the supplier. Behavior may be undefined if this isn't the case.

Author

fzzyhmstrs

Since

0.2.6

Parameters

predicate

Predicate - tests a candidate String to see if it is allowable

supplier

Supplier> - supplies all allowable String in the form of a list. As typical with suppliers, it is not required but beneficial that the supplier provide a new list on each call

See also

Constructors

Link copied to clipboard
constructor(predicate: Predicate<String>, supplier: Supplier<List<String>>)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard

Validates (not corrects) the provided String versus the provided Predicate

Link copied to clipboard
fun get(): List<String>

Supplies the allowable identifier list

Link copied to clipboard
open override fun getSuggestions(input: String, cursor: Int, choiceValidator: ChoiceValidator<String>): CompletableFuture<Suggestions>

Returns Suggestions based on the allowable string list and a choice validator

Link copied to clipboard
fun test(str: String): Boolean

Test the provided String vs. the predicate

Link copied to clipboard

Validates the provided String versus the provided Predicate